package com.lysj.admin.file.api.controller;

import com.lysj.admin.file.api.base.ApiContent;
import com.lysj.admin.utils.web.Resp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author ZhangWenJian
 * @data 2019/1/11--9:55
 * @description
 */
@RestController
@RequestMapping("/api/v1/upload")
@Api("上传接口")
public class ApiUploadController extends ApiContent {

    @ApiOperation(value = "上传")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "files", value = "文件集合", required = true, paramType = "form", dataType = "file"),
            @ApiImplicitParam(name = "uploaderId", value = "上传者Id(选传)", required = false, paramType = "form", dataType = "string"),
    })

    @PostMapping("/files_upload/{project}/{model}")
    public Resp filesUpload(MultipartFile[] files, String uploaderId, @PathVariable String project, @PathVariable String model){
        return uploadFileService.filesUpload(files,uploaderId,project,model);
    }
}
